# Virtual Router Simulator 
#
# Copyright (C) 2009-2010 VRSim Project
# Author: Choonho Son <choonho@kt.com>
# URL: <http://vrsim.googlecode.com>
# For license information, see LICENSE.TXT
#
from VRSim.Node.CiscoDevices import CiscoDevices
from VRSim.Node.Domain import disk
from VRSim.Node.Interface import Interface

from VRSim.Utils import debug

"""
type     number of slot
-------------------------------
3620    2 (0~1)
3640    4 (0~3)
3660    6 (1~6)
"""
class C3600Device(CiscoDevices):
    def __init__(self,  nodeid):
        CiscoDevices.__init__(self,  nodeid)
        
        self.maxSlot = 6
        self.slot = {
                     'slot 0': {"adapter": ["NM-1FE-TX",  1], 
                                0 : Interface(0, 0,  model='c3600', adapter='NM-1FE-TX',  enabled=True)
                                }, 
                     'slot 1': {"adapter": ["NM-16ESW",  16], 
                                0 : Interface(1, 0,  model='c3600',  adapter = 'NM-16ESW',  enabled=True),  
                                1 : Interface(1,  1,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                2 : Interface(1,  2,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                3 : Interface(1,  3,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                4 : Interface(1, 4,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                5 : Interface(1,  5,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                6 : Interface(1,  6,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                7 : Interface(1,  7,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                8 : Interface(1,  8,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                9 : Interface(1,  9,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                10 : Interface(1,  10,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                11 : Interface(1,  11,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                12 : Interface(1,  12,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                13 : Interface(1,  13,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                14 : Interface(1,  14,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                15 : Interface(1,  15,  model='c3600',  adapter = 'NM-16ESW',  enabled=True), 
                                },
                    'slot 2': {"adapter": ["NM-16ESW",  16], 
                                0 : Interface(2, 0,  model='c3600',  adapter = 'NM-16ESW'),  
                                1 : Interface(2,  1,  model='c3600',  adapter = 'NM-16ESW'), 
                                2 : Interface(2,  2,  model='c3600',  adapter = 'NM-16ESW'), 
                                3 : Interface(2,  3,  model='c3600',  adapter = 'NM-16ESW'), 
                                4 : Interface(2, 4,  model='c3600',  adapter = 'NM-16ESW'), 
                                5 : Interface(2,  5,  model='c3600',  adapter = 'NM-16ESW'), 
                                6 : Interface(2,  6,  model='c3600',  adapter = 'NM-16ESW'), 
                                7 : Interface(2,  7,  model='c3600',  adapter = 'NM-16ESW'), 
                                8 : Interface(2,  8,  model='c3600',  adapter = 'NM-16ESW'), 
                                9 : Interface(2,  9,  model='c3600',  adapter = 'NM-16ESW'), 
                                10 : Interface(2,  10,  model='c3600',  adapter = 'NM-16ESW'), 
                                11 : Interface(2,  11,  model='c3600',  adapter = 'NM-16ESW'), 
                                12 : Interface(2,  12,  model='c3600',  adapter = 'NM-16ESW'), 
                                13 : Interface(2,  13,  model='c3600',  adapter = 'NM-16ESW'), 
                                14 : Interface(2,  14,  model='c3600',  adapter = 'NM-16ESW'), 
                                15 : Interface(2,  15,  model='c3600',  adapter = 'NM-16ESW'), 
                                },            
                     'slot 3': {"adapter": ["NM-16ESW",  16], 
                                0 : Interface(3, 0,  model='c3600',  adapter = 'NM-16ESW'),  
                                1 : Interface(3,  1,  model='c3600',  adapter = 'NM-16ESW'), 
                                2 : Interface(3,  2,  model='c3600',  adapter = 'NM-16ESW'), 
                                3 : Interface(3,  3,  model='c3600',  adapter = 'NM-16ESW'), 
                                4 : Interface(3, 4,  model='c3600',  adapter = 'NM-16ESW'), 
                                5 : Interface(3,  5,  model='c3600',  adapter = 'NM-16ESW'), 
                                6 : Interface(3,  6,  model='c3600',  adapter = 'NM-16ESW'), 
                                7 : Interface(3,  7,  model='c3600',  adapter = 'NM-16ESW'), 
                                8 : Interface(3,  8,  model='c3600',  adapter = 'NM-16ESW'), 
                                9 : Interface(3,  9,  model='c3600',  adapter = 'NM-16ESW'), 
                                10 : Interface(3,  10,  model='c3600',  adapter = 'NM-16ESW'), 
                                11 : Interface(3,  11,  model='c3600',  adapter = 'NM-16ESW'), 
                                12 : Interface(3,  12,  model='c3600',  adapter = 'NM-16ESW'), 
                                13 : Interface(3,  13,  model='c3600',  adapter = 'NM-16ESW'), 
                                14 : Interface(3,  14,  model='c3600',  adapter = 'NM-16ESW'), 
                                15 : Interface(3,  15,  model='c3600',  adapter = 'NM-16ESW'), 
                                },            
                     
                     }
        
    def getPossibleAdapter(self,  slot=0):
        """ return adapter and max interface
        return value is dictionary
        """
        debug(slot,  "c3600Domain : getPossibleAdapter")
        if str(slot) == '0' or str(slot) == "slot 0":
            return {"NM-1FE-TX" : 1 }
        else:
            return {"NM-1FE-TX" : 1, 
            "NM-16ESW" : 16 }
    
    def getAdapterFromBandwidth(self,  bandWidth):
        if bandWidth == "E":
            #return ["NM-16ESW"]
            return []
            
        elif bandWidth == "FE":
            return ["NM-1FE-TX",  "NM-16ESW"]
        else:
            return ["NM-16ESW"]
    
